Make the default background for GdkWindows transparent
authorAlexander Larsson <alexl@redhat.com>
Thu, 9 Feb 2012 15:38:54 +0000 (16:38 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 9 Feb 2012 15:39:23 +0000 (16:39 +0100)
With the changes in default CSS to make the default background transparent
we ran into issues where intermediate GdkWindow (for instance the
view_window in GtkViewport) where we didn't set an explicit background
(because before they were always covered). So instead of showing throught
the transparent windows were showing the default backgroind of the intermediate
window (i.e. black).

With this change we also needed to fix GtkViewport, as it was previously
relying on the bin and view windows to cover widget->window so that the
border was not visible if shadow_type was NONE.

gdk/gdkwindow.c
gtk/gtkviewport.c

index 8dddcd1704ccfb6da72953b4e3de04115a884ef6..1a64f43cb41c89c7ea136dd4c760dc4cddadfab7 100644 (file)
@@ -1420,7 +1420,8 @@ gdk_window_new (GdkWindow     *parent,
       window->depth = window->visual->depth;
 
       /* XXX: Cache this somehow? */
-      window->background = cairo_pattern_create_rgb (0, 0, 0);
+      window->background = cairo_pattern_create_rgba (0, 0, 0, 0);
+      window->has_alpha_background = TRUE;
     }
   else
     {
index 73238ee8b8e902fc90a9d5cad037fc17cec7d191..6476988beb0339a9c67932abca68f2d4b4e5d638 100644 (file)
@@ -755,7 +755,8 @@ gtk_viewport_draw (GtkWidget *widget,
 
   context = gtk_widget_get_style_context (widget);
 
-  if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
+  if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)) &&
+      priv->shadow_type != GTK_SHADOW_NONE)
     {
       gtk_style_context_save (context);
       gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);